<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Comment extends Model
{
    //子分类
    public function childs()
    {
        return $this->hasMany('App\Models\Comment', 'comment_id', 'id')->orderBy('created_at', 'desc');
    }

    //所有子类
    public function allChilds()
    {
        return $this->childs()->with('allChilds');
    }

    public function member()
    {
        return $this->belongsTo('App\Models\Member');
    }
}
